
<html>
<head><title>Simple jsp page</title></head>



<script src='/spymenow_web/dwr/engine.js'></script>
<script src='/spymenow_web/dwr/util.js'></script>
<script src='/spymenow_web/dwr/interface/LoggerPointsImpl.js'></script>
<script type="text/javascript" src="/spymenow_web/js/dhtml-suite.js"></script>
<script src='/spymenow_web/js/schema.js'></script>

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAsDELmuOSQh2x6rOkeMR1FRTinQmAoIpAbE0OY077NMR3enrO0RQneZQr3gCDD_OB-ki66PwOomxhzg"></script>

<script src="/spymenow_web/js/greversegeocoderv105.js" type="text/javascript"></script>

<link rel="stylesheet" href="/spymenow_web/css/demos.css" media="screen" type="text/css">

<body>
<br>

<input type="text" name="imei" id="imei" value="123456789"/>
<br>
DataI : <input type="text" name="dateTimeI" id="dateTimeI" value="01/01/1999 01:00:00"/>&nbsp;&nbsp;&nbsp;
DataF: <input type="text" name="dateTimeF" id="dateTimeF" value="01/01/2011 01:00:00"/>

<input type="button" value="LISTA" onclick="listLogger();">
<input type="button" value="GET" onclick="$loggerPoints.get()">
<input type="button" value="Address" onclick="reverse('45.428606','8.744066')">
        



	<div id="loggerDIV"></div>
	<div id="infoAddress"></div>

<br><br><br><br>
	<div id="map" style="width: 400px; height: 400px;"></div>



<script>
var iRecord = 0;
var flReverse = true;
var lsResultLP;
var listLoggerPoints = new Array();
var loggerPointsVO = function() {this.date = ""; this.latitude = ""; this.longitude = "", this.address = "" };

var rg = new GReverseGeocoder();
GEvent.addListener(rg, "load", showresult);

	function showresult(placemark) {
	  var address = placemark.address + " " + placemark.AddressDetails.Country.CountryNameCode;
	  lsResultLP[iRecord].address = address;
	  //document.getElementById("infoAddress").innerText =  document.getElementById("infoAddress").innerText + "<br>" + address;
	  iRecord++;
	  flReverse = true;
	  if(iRecord >= lsResultLP.length)
			createTable2(lsResultLP);
			

	}

	function reverse(latitude, longitude){
	  var point = new GLatLng(latitude, longitude);
	  rg.reverseGeocode(point);
	}
	
	function listLogger(){
		$loggerPoints.list();
	}
	
	function setListLoggerPoints(obj){
		listLoggerPoints = obj;	
		lsResultLP = new Array();
		for(var i=0; i<listLoggerPoints.length; i++){
			var point = listLoggerPoints[i];
			var lpVO = new loggerPointsVO();  
			lpVO.latitude = point.latitude;
			lpVO.longitude = point.longitude;
			lpVO.date = point.date;
			lpVO.address = "";
			lsResultLP[i]=lpVO;
		}
		startInterval();
		
	}
	
	var objInterval;
	function startInterval(){
		objInterval = setInterval("reverseAddress()",50);
	}
	function stopInterval(){
		clearInterval(objInterval);
	}
	
	function reverseAddress(){
		if(flReverse){
			if(iRecord < lsResultLP.length){
				reverse(lsResultLP[iRecord].latitude, lsResultLP[iRecord].longitude);
				flReverse=false;
			}else{
				stopInterval();
			}
		}
		
	}
</script>



</body>
</html>